home *** CD-ROM | disk | FTP | other *** search
- // include javascript classes
- include("oops/r3slider.js");
- include("oops/r3checkb.js");
- include("oops/r3window.js");
- include("oops/r3packer.js");
-
- // Here is all the functionality needed to create dynamic
- // layouts. When the user clicks the check box, we set or clear
- // the Stealth attribute of appropriate packer and call FIT to
- // update the layout.
-
- function showAdvanced(gadget, event, checked)
- {
- if(event == R3OGM_GADGETUP) {
- if(checked)
- gadget.packer.SetStealth(FALSE);
- else
- gadget.packer.SetStealth(TRUE);
- gadget.window.FIT(R3WFP_BESTFIT);
- }
- return 1;
- }
-
- // Rest of the code is very standard stuff then.
-
- window = new r3Window(R3WGA_Parent, _r3gui,
- R3WGA_Left, 200,
- R3WGA_Top, 100,
- R3WA_Title, "Dynamic GUI",
- R3WA_ReportCloseWindow, TRUE,
- R3WA_ReportNewSize, TRUE);
-
- packer = new r3Packer(R3PA_Orientation, R3PAOF_VERTICAL);
- window.SetGmanager(packer);
-
- // create fixed controls
- for(i = 0; i < 3; i++) {
- slider = new r3Slider(R3WGA_Parent, window,
- R3GA_Text, "Slider " + i);
- if(slider)
- packer.ADD(R3PAPF_EXPAND | R3PAPF_FILLX | R3PAPF_FILLY, 0, slider);
- }
-
-
- // create a check box
- checkb = new r3Checkbox(R3RA_Hook, showAdvanced,
- R3WGA_Parent, window,
- R3GA_Text, "Advanced",
- R3GA_ToolTip, "Access advanced controls");
- if(checkb)
- packer.ADD(R3PAPF_EXPAND | R3PAPF_FILLX | R3PAPF_FILLY, 0, checkb);
-
- // create packer for the advanced controls
- // and insert couple of sliders to it.
- packAdvanced = new r3Packer(R3PA_Orientation, R3PAOF_VERTICAL);
- packer.ADD(R3PAPF_EXPAND | R3PAPF_FILLX, 0, packAdvanced);
-
- for(i = 0; i < 2; i++) {
- slider = new r3Slider(R3WGA_Parent, window,
- R3GA_Text, "Advanced " + i);
- if(slider)
- packAdvanced.ADD(R3PAPF_EXPAND | R3PAPF_FILLX, 0, slider);
- }
-
- // hide the advanced controls by default
- packAdvanced.SetStealth(TRUE);
-
-
- // tell checkbox where to find the advanced packer,
- // so that we can access it from the check boxe's callback function.
- checkb.packer = packAdvanced;
- checkb.window = window;
-
- window.FIT(R3WFP_BESTFIT);
- window.REALIZE();
-
-
-